#include "Point3.h"
#include "Utility/MathUtility.h"
#include "Vector3Template.h"

Point3::Point3(){}

Point3::Point3(int x, int y, int z):
	_x(x), _y(y), _z(z){}

Point3 Point3::zero()
{
	return Point3(0, 0, 0);
}

Point3 Point3::clamp(const Point3& p, int s, int e)
{
	Point3 tmp;
	tmp._x = Math::Clamp(p._x, s, e);
	tmp._y = Math::Clamp(p._y, s, e);
	tmp._z = Math::Clamp(p._z, s, e);

	return tmp;
}

Vector3f Point3::operator *= (float s)
{
	Vector3f tmp;
	tmp.x = static_cast<float>(_x) * s; 
	tmp.y = static_cast<float>(_y) * s; 
	tmp.z = static_cast<float>(_z) * s;

	return tmp;
}

Point3& Point3::operator *= (int s)
{
	_x *= s;
	_y *= s;
	_z *= s;
	return *this;
}

Point3& Point3::operator += (const Point3& p)
{
	_x += p._x;
	_y += p._y;
	_z += p._z;

	return *this;
}

Point3&  Point3::operator -= (const Point3& p)
{
	_x -= p._x;
	_y -= p._y;
	_z -= p._z;

	return *this;
}

Vector3f operator * (const Point3& p, float s)
{
	Point3 tmp(p);
	return (tmp *= s);
}

Point3 operator * (const Point3& p, int s)
{
	Point3 tmp(p);
	return (tmp *= s);
}

Point3  operator + (const Point3& p1, const Point3& p2)
{
	Point3 tmp(p1);
	return (tmp += p2);
}

Point3  operator - (const Point3& p1, const Point3& p2)
{
	Point3 tmp(p1);
	return (tmp -= p2);
}

bool operator == (const Point3& p1, const Point3& p2)
{
	return ( (p1._x == p2._x) && (p1._y == p2._y) && (p1._z == p2._z) );
}

bool operator != (const Point3& p1, const Point3& p2)
{
	return !(p1 == p2);
}